import rospy
from topic_communication.msg import Person
"""
订阅方:
    订阅消息

"""

def doPerson(p):
    rospy.loginfo("接收到的人的信息:%s, %d, %.2f",p.name, p.age, p.height)


if __name__ == "__main__":
    #1.初始化节点
    rospy.init_node("listener_msg_py")
    #2.创建订阅者对象
    sub = rospy.Subscriber("topic_msg",Person,doPerson,queue_size=10)
    rospy.spin() #4.循环

"""
    配置CMakeLists.txt
    catkin_install_python(PROGRAMS
    scripts/文件名称.py
    DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
    )
"""